package com.ruoyi.web.controller.merchant;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.merchant.domain.dto.UpdateMerchantInfoRequest;
import com.ruoyi.merchant.service.IMerchantService;
import com.ruoyi.merchant.utils.MerchantSecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/merchant/profile")
public class MerchantProfileController {
    @Autowired
    private IMerchantService merchantService;

    @PutMapping("/update")
    public AjaxResult update(@RequestBody @Validated UpdateMerchantInfoRequest req) {
        Long merchantId = MerchantSecurityUtils.getMerchantId();
        merchantService.updateMerchantInfo(merchantId, req);
        return AjaxResult.success("修改成功");
    }
}
